#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QMediaPlayer>
#include <QMediaPlaylist>
#include <QVideoWidget>
#include <QPushButton>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QGridLayout>
#include <QListWidget>
#include <QTimer>
#include <QSlider>

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
protected:
    bool eventFilter(QObject *watched, QEvent *event);
private:
    void initLayout();
    void initConnect();
    void initMedia();
    void scanMedia();
private:
    QMediaPlayer* mediaPlayer = nullptr;
    QMediaPlaylist* mediaPlaylist = nullptr;
    QVideoWidget *videoWidget = nullptr;
    QListWidget* listWidget = nullptr;
    QWidget* playWidget = nullptr;
    QSlider* playProgress = nullptr;
    QPushButton* fullBtn = nullptr;
    QPushButton* prevBtn = nullptr;
    QPushButton* playBtn = nullptr;
    QPushButton* nextBtn = nullptr;
    QHBoxLayout* hBoxLayout = nullptr;
    QWidget* hWidget = nullptr;
    QVBoxLayout* vBoxLayout = nullptr;
    QWidget* vWidget = nullptr;
    QTimer* timer = nullptr;
private slots:
    void fullPlayer();
    void prevPlayer();
    void startPlayer();
    void nextPlayer();
    void durationChange(quint64);
    void positionChange(quint64);
    void valueChange(int);
    void sliderMove(int);
    void currentIndexChange(int);
    void timerout();
};

#endif // MAINWINDOW_H
